﻿using System;
using System.Data;
using System.Configuration;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using System.Data.SqlClient;
using System.Collections.Generic;
using BTN04.DTO;

namespace BTN04.DAO
{
    public class TinhTrangLoaiSanPhamDAO
    {
        public List<TinhTrangLoaiSanPhamDTO> DanhSachTinhTrangLoaiSanPham()
        {
            List<TinhTrangLoaiSanPhamDTO> _danhSach = new List<TinhTrangLoaiSanPhamDTO>();
            string sql = "SELECT * FROM TinhTrangLoaiSanPham";
            SqlConnection cnn = new SqlConnection(DataProvider.ConnectionString);
            SqlCommand comand = new SqlCommand(sql, cnn);
            cnn.Open();
            SqlDataReader read = comand.ExecuteReader();
            while (read.Read())
            {
                TinhTrangLoaiSanPhamDTO trlspDTO = new TinhTrangLoaiSanPhamDTO();
               trlspDTO.MaTinhTrangLoaiSanPham = int.Parse(read["MaTinhTrangLoaiSanPham"].ToString());
              trlspDTO.TenTinhTrangLoaiSanPham = read["TenTinhTrangLoaiSanPham"].ToString();
                _danhSach.Add(trlspDTO);
            }
            return _danhSach;
        }
    }
}
